﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace JiaBao.Register
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Btn_Register_Click(object sender, RoutedEventArgs e)
        {
            if (txt_Nubmer.Text.Trim().Length > 0)
                txt_Key.Text = GetSN(txt_Nubmer.Text.Trim());

        }

        private string GetSN(string str)
        {
            string strResult = "";//作为返回的字符串
            StringBuilder sbTemp = new StringBuilder();
            //生成注册码
            for (int i = 0; i < str.Length; i++)
            {
                int tIn = str[i] % 10;
                string tCh = tIn.ToString();
                sbTemp.Append(tCh);
            }
            strResult = sbTemp.ToString();
            return strResult;
        }

        private void btn_RegisterTest_Click(object sender, RoutedEventArgs e)
        {
            if (txt_Nubmer.Text.Trim().Length > 0)
                txt_Key.Text = GetSN(GetSN(txt_Nubmer.Text.Trim()));

        }
    }
}
